package com.csxh.web.struts.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3805938789179460293L;
	private static final String CONTEXT_DATA_KEY = "data";
	private static final String FORWARD = "forward";
	private static final String REDIRECT = "redirect";
	private static final String REDIRECT_ACTION = "redirectAction";

	private Map<String,Object> dataMap=new HashMap<String,Object>();
	protected void setRequestScopeData(HttpServletRequest request, String key,Object value){
		this.dataMap.put(key, value);
		request.setAttribute(CONTEXT_DATA_KEY, this.dataMap);
	}
	protected void setSessionScopeData(HttpServletRequest request,String key,Object value){
		this.dataMap.put(key, value);
		request.getSession().setAttribute(CONTEXT_DATA_KEY, this.dataMap);
	}
	protected void setApplicationScopeData(HttpServletRequest request,String key,Object value){
		this.dataMap.put(key, value);
		request.getServletContext().setAttribute(CONTEXT_DATA_KEY, this.dataMap);
	}
	
	private String error="/error.jsp";
	private String forward;
	private String redirect;
	private String redirectAction;
	public String getError() {
		return error;
	}
	public void setError(String error) {
		this.error = error;
	}
	public String getForward() {
		return forward;
	}
	public void setForward(String forward) {
		this.forward = forward;
	}
	public String getRedirect() {
		return redirect;
	}
	public void setRedirect(String redirect) {
		this.redirect = redirect;
	}
	public String getRedirectAction() {
		return redirectAction;
	}
	public void setRedirectAction(String redirectAction) {
		this.redirectAction = redirectAction;
	}
	
}
